package com.ruoyi.rsikManage.mapper;


import com.ruoyi.rsikManage.domain.TVideoStandPlace;
import com.ruoyi.rsikManage.domain.PlaceCategory;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;


/**
 * 视频场所标准字典Mapper接口
 *
 * @author ruoyi
 * @date 2023-08-08
 */
@Mapper
public interface TVideoStandPlaceMapper
{
    int checkHasMonitorRelPlace(@Param("placeCategoryDicVal") String placeCategoryDicVal,@Param("monitorId") String monitorId);

    int checkHasMonitorRelPlaceForUnitCodes(@Param("placeCategoryDicVal") String placeCategoryDicVal,
                                            @Param("monitorId") String monitorId,
                                            @Param("unitCode") Long unitCode);

    List<PlaceCategory> selectPlaceCategoryDicList(@Param("dicType") String dicType, @Param("parentDicVal") String parentDicVal);
    /**
     * 查询视频场所标准字典
     *
     * @param id 视频场所标准字典ID
     * @return 视频场所标准字典
     */
    public TVideoStandPlace selectTVideoStandPlaceById(Long id);

    /**
     * 查询视频场所标准字典列表
     *
     * @param tVideoStandPlace 视频场所标准字典
     * @return 视频场所标准字典集合
     */
    public List<TVideoStandPlace> selectTVideoStandPlaceList(TVideoStandPlace tVideoStandPlace);

    public List<TVideoStandPlace> selectPlaceListWithMonitors(TVideoStandPlace tVideoStandPlace);

    public List<TVideoStandPlace> selectPlaceListWithMonitorsForUnitCodes(TVideoStandPlace tVideoStandPlace);



    /**
     *  给某个场所下新增一个监控点
     * @param placeParentLevelDicVal 场所父类别的字典值
     * @param placeId 场所id
     * @param monitorId 监控点id
     * @return
     */
    public Integer addMonitorRelPlace(@Param("placeParentLevelDicVal") String placeParentLevelDicVal , @Param("placeChildLevelDicVal") String placeChildLevelDicVal, @Param("placeId") Long placeId,@Param("monitorId") String monitorId);

    /**
     *  给某个场所下新增一个监控点
     * @param placeParentLevelDicVal 场所父类别的字典值
     * @param placeId 场所id
     * @param monitorId 监控点id
     * @return
     */

    public Integer addMonitorRelPlaceForUnitCodes(@Param("placeParentLevelDicVal") String placeParentLevelDicVal ,
                                      @Param("placeChildLevelDicVal") String placeChildLevelDicVal,
                                      @Param("placeId") Long placeId,
                                      @Param("monitorId") String monitorId,
                                      @Param("unitCode") Long unitCode);

    /**
     * 删除某个场所和监控点的关联
     *
     * @param placeParentLevelDicVal 场所父类别的字典值
     * @param placeId 场所id
     * @param monitorId 监控点id
     * @return
     */
    public void delMonitorRelPlace(@Param("placeParentLevelDicVal") String placeParentLevelDicVal , @Param("placeId") Long placeId,@Param("monitorId") String monitorId);

    public void delMonitorRelPlaceForUnitCodes(@Param("placeParentLevelDicVal") String placeParentLevelDicVal ,
                                               @Param("placeId") Long placeId,
                                               @Param("monitorId") String monitorId,
                                               @Param("unitCode") Long unitCode);

    int  delMonitorRelAllPlace(@Param("monitorId")String monitorId);

    int  delMonitorRelAllPlaceForUnitCodes(@Param("monitorId")String monitorId,@Param("unitCode")Long unitCode);


    /**
     * 新增视频场所标准字典
     *
     * @param tVideoStandPlace 视频场所标准字典
     * @return 结果
     */
    public int insertTVideoStandPlace(TVideoStandPlace tVideoStandPlace);

    /**
     * 修改视频场所标准字典
     *
     * @param tVideoStandPlace 视频场所标准字典
     * @return 结果
     */
    public int updateTVideoStandPlace(TVideoStandPlace tVideoStandPlace);

    /**
     * 删除视频场所标准字典
     *
     * @param id 视频场所标准字典ID
     * @return 结果
     */
    public int deleteTVideoStandPlaceById(Long id);

    /**
     * 批量删除视频场所标准字典
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    public int deleteTVideoStandPlaceByIds(Long[] ids);

    List<TVideoStandPlace> getSamePlace(String placeName);

    List<TVideoStandPlace> getSamePlaceForUnitCodes(@Param("placeName") String placeName,
                                                    @Param("unitCode") Long unitCode);


    List<PlaceCategory> selectCategoryListWithPlacesWithMonitors();
}
